﻿var Formsy = {

    //---
    // validates checkboxes, radiosbuttons, checkbox lists, and radiobutton lists.
    validateRequired: function (source, args) {
        // get input elements - there should only be one
        var siblings = source.parentNode.getElementsByTagName('input');
        for (var i = 0; i < siblings.length; i++) {
            var type = siblings[i].type;
            if (type == 'checkbox' || type == 'radio') {
                if (siblings[i].checked == true) {
                    args.IsValid = 'true';
                    return;
                }

            }
        }
        args.IsValid = false;
    },

    //---
    // clears file input
    clearFileInput: function (control) {
        var fileUpload = document.getElementById(control);
        fileUpload.value = null;
        return false;
    }
}